import request from './request'

// 获取可预约时间段列表
export function getAvailableTimeSlots(params) {
  return request({
    url: '/appointments/available-slots',
    method: 'get',
    params
  })
}

// 获取设计师列表
export function getDesignerList(params) {
  return request({
    url: '/designers',
    method: 'get',
    params
  })
}

// 提交预约申请
export function submitAppointment(data) {
  return request({
    url: '/appointment',
    method: 'post',
    data
  })
}

// 获取预约列表
export function getAppointmentList(params) {
  return request({
    url: '/appointments',
    method: 'get',
    params
  })
}

// 获取预约详情
export function getAppointmentDetail(id) {
  return request({
    url: `/appointments/${id}`,
    method: 'get'
  })
}

// 取消预约
export function cancelAppointment(id, reason) {
  return request({
    url: `/appointments/${id}/cancel`,
    method: 'put',
    data: { reason }
  })
}

// 修改预约
export function updateAppointment(id, data) {
  return request({
    url: `/appointment/${id}`,
    method: 'put',
    data
  })
}

// 评价预约
export function rateAppointment(id, data) {
  return request({
    url: `/appointment/${id}/rate`,
    method: 'post',
    data
  })
}

// 确认预约
export function confirmAppointment(id) {
  return request({
    url: `/appointment/${id}/confirm`,
    method: 'put'
  })
}

// 获取设计师详情
export function getDesignerDetail(id) {
  return request({
    url: `/designers/${id}`,
    method: 'get'
  })
}

// 获取设计师可预约时间
export function getDesignerAvailableTimes(id, date) {
  return request({
    url: `/appointment/designers/${id}/available-times`,
    method: 'get',
    params: { date }
  })
}

// 创建预约
export function createAppointment(data) {
  return request({
    url: '/appointments',
    method: 'post',
    data
  })
}

// 更新预约状态
export function updateAppointmentStatus(id, status) {
  return request({
    url: `/appointments/${id}/status`,
    method: 'put',
    data: { status }
  })
} 